var async = require("async");
var renderEngin = require("../common/renderEngin");
var Tools = require("../common/tools");
exports.bill_detail = function(req, res) {
    use(["public/javascripts/bill_detail/init.js", "public/javascripts/service/bill_detailService.js"], function(PageComponent, bill_detailService) {
        var storage = {};
        storage["slider"] = Tools.getPageSliderData("user_center");
        storage["billNo"] = req.query.id;
        storage["customerId"] = req.query.uid;
        storage["type"] = req.query.type;
        storage["current"] = 1;
        storage["pageSize"] = 10;
        bill_detailService.searchOrders({
            headers: req.headers,
            urlParams: {
                billNo: req.query.id,
                customerId: req.query.uid,
            }
        }, function (result) {
            if (result.errorCode == 0) {
                storage["orderList"] = result;
                storage["list"] = result.data;
                storage["total"] = result.pagination.totalResult;
            } else {
                storage["orderList"] = {};
                storage["list"] = [];
                storage["total"] = 0;
            }
            PageComponent = React.createFactory(PageComponent);
            renderEngin.call(res, 'bill_detail', PageComponent, storage);
        })
    });
}